" vim:ft=vim
" Test top classes

Before;
let object = object#object_()
let type = object#type_()
let None = object#None()
let NoneType = object#type(None)
let tops = [ object, type, NoneType ]


Execute(subclass relationship of top classes);
Assert object.__base__ is# None
AssertEqual object.__bases__, [None]
Assert type.__base__ is# object
Assert NoneType.__base__ is# object


Execute(instance relationship of top classes);
for x in tops
  Assert x.__class__ is# type
endfor


Execute(__repr__ of class objects);
for x in tops
  Assert object#repr(x) =~# "<class '.*'>"
endfor

Execute (MRO for top classes);
AssertEqual object.__mro__, [object]
AssertEqual type.__mro__, [type, object]
AssertEqual NoneType.__mro__, [NoneType, type, object]


Execute(Special object: None);
Assert None.__class__ is# NoneType
AssertEqual 0, object#bool(None), 'None is false'
AssertEqual 'None', object#repr(None)
AssertEqual 'None', object#str(None)
AssertThrows call object#new(g:NoneType)

Log g:vader_exception
Assert g:vader_exception =~# 'TypeError'
Log object#dir(None)


Execute(Plain object instance);
let obj = object#object()
AssertEqual 1, object#bool(obj)
AssertEqual object#str(obj), '<object object>'
AssertEqual object#str(obj), object#repr(obj)
